package uy.com.tsi2G7.superbet.ui;

import java.util.ArrayList;
import java.util.List;

import uy.com.tsi2G7.superbet.event.EventSource;

public class MenuDescriptor {
	
	private List<MenuDescriptor> children=new ArrayList<MenuDescriptor>();
	private Long id;
    private String name;
    private EventSource source;
    
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public List<MenuDescriptor> getChildren() {
		return children;
	}
	public void setChildren(List<MenuDescriptor> children) {
		this.children = children;
	}
	
    public MenuDescriptor getChildById(String id) {
        for (MenuDescriptor sample : getChildren()) {
            if (sample.getId().longValue()==Long.valueOf(id).longValue()) {
                return sample;
            }
        }
        if(children.isEmpty())
        	return null;
        return children.get(0);
    }
	public EventSource getSource() {
		return source;
	}
	public void setSource(EventSource source) {
		this.source = source;
	}

    
    

}
